feat: Add methods for checked arithmetics to StakeHistoryEntry#394
Conversation
The usage of existing `std::ops::Add` implementation triggers the `arithmetic_side_effects` clippy lint. To allow addressing it, add the following methods to `StakeHistoryEntry`: * `checked_add` * `wrapping_add` * `saturating_add`
joncinque
left a comment
There was a problem hiding this comment.
Makes sense to me! We might want to consider deprecating the normal ops::Add implementation then
Sadly, Rust doesn't support deprecating specific trait implementations or trait methods. But perhaps we could go for a more drastic measure and remove the implementation entirely? |
Oh right of course, my mistake 😓 but yeah I'm fine with doing a full removal during a breaking change. Let's wait on it though. Maybe we should add a comment to remember to remove it though. What do you think? |
Good idea, #406 |
…ana-program/stake#394) The usage of existing `std::ops::Add` implementation triggers the `arithmetic_side_effects` clippy lint. To allow addressing it, add the following methods to `StakeHistoryEntry`: * `checked_add` * `wrapping_add` * `saturating_add`
The usage of existing
std::ops::Addimplementation triggers thearithmetic_side_effectsclippy lint.To allow addressing it, add the following methods to
StakeHistoryEntry:checked_addwrapping_addsaturating_add